feat: add microfrontend template generator command#943
Conversation
|
Thanks for the contribution! Unfortunately we can't verify the commit author(s): Aman Singh <a***@A***.i***.s***.com>. One possible solution is to add that email to your GitHub account. Alternatively you can change your commits to another email and force push the change. After getting your commits associated with your GitHub account, sign the Salesforce Inc. Contributor License Agreement and this Pull Request will be revalidated. |
Exposes `sf template generate microfrontend` to scaffold a microfrontend LWC bundle, paired with the new generator in salesforcedx-templates.
3028578 to
0efa415
Compare
|
@salesforce-cla check |
Per team alignment in #plugin-design-templates, rename the command to align with the <lightning-embedding> base component name. - Command: sf template generate microfrontend → sf template generate lightning embedding - Move src/commands/template/generate/microfrontend.ts under lightning/ as a peer of app, component, event, interface, test - messages/microfrontend.md → messages/lightningEmbedding.md - Class Microfrontend → LightningEmbedding - Imports updated: MicrofrontendOptions → LightningEmbeddingOptions, TemplateType.Microfrontend → TemplateType.LightningEmbedding
c4b860a to
d72b7f5
Compare
| Messages.importMessagesDirectoryFromMetaUrl(import.meta.url); | ||
| const messages = Messages.loadMessages('@salesforce/plugin-templates', 'lightningEmbedding'); | ||
|
|
||
| // Keep in-sync with VALID_SANDBOX_TOKENS in salesforcedx-templates/src/generators/lightningEmbeddingGenerator.ts |
There was a problem hiding this comment.
Why not export these from the library?
| description: messages.getMessage('flags.name.description'), | ||
| required: true, | ||
| }), | ||
| src: Flags.string({ |
There was a problem hiding this comment.
Can you use Flags.url here instead? If not, consider adding a parse method to validate this input
| componentname: flags.name, | ||
| src: flags.src, | ||
| sandbox: flags.sandbox.join(' '), | ||
| shellTitle: flags['shell-title'] ?? flags.name, |
There was a problem hiding this comment.
If --shell-title is for screen reader accessibility, a PascalCase fallback is less than ideal. Just make --shell-title required and don't have a fallback.
|
Please add tests for these templates. Lots of examples in |
Summary
sf template generate lightning embeddingto scaffold a Lightning Web Component bundle that wraps<lightning-embedding>.lightningtopic as a peer ofapp,component,event,interface,test(per team alignment in #plugin-design-templates — avoids bothmfeandmicrofrontend).--name,--src,--sandbox(multi-value, validated against W3C sandbox tokens),--shell-title,--output-dir,--api-version,--internal.--srcvalidation: https only; plain http allowed only forlocalhost/127.0.0.1(local dev).static hidden = trueuntil rollout is finalized.LightningEmbeddingGeneratorin feat: add microfrontend template generator forcedotcom/salesforcedx-templates#821.